//SIMMON_ADD
package com.wehealth;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.umeng.analytics.MobclickAgent;
import com.wehealth.dm.DM_Messages;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

@SuppressLint("ValidFragment")
public class Message_content extends Fragment {
	
	private DM_Messages message;
	private MainActivity activity;
	
	
	public  Message_content()
	{
		Log.i("init:", "Message"); 
	}
	
	public  Message_content(DM_Messages message)
	{
		this.message = message;
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		return  inflater.inflate(R.layout.news_message, null);
	}
	
	
	
	public void onActivityCreated(Bundle savedInstanceState){
		
		super.onActivityCreated(savedInstanceState);
		
		 activity = (MainActivity)getActivity();
		MobclickAgent.openActivityDurationTrack(false);
		RelativeLayout header_view = (RelativeLayout)activity.findViewById(R.id.header_view);
		header_view.setBackgroundResource(R.drawable.bg_redbar);
		TextView titleView =(TextView)activity.findViewById(R.id.header_title);
		String title = message.getTitle();
		titleView.setText(title);
		
		TextView contentView = (TextView)activity.findViewById(R.id.news_message);
		String content = message.getMessage();
		contentView.setText(content);
		
		//返回主页按钮-------------------------------------------------------//
		 Button bBack = (Button) activity.findViewById(R.id.header_bBack);
			
		 bBack.setOnClickListener(new View.OnClickListener()
			{
				public void onClick(View v)
				{
					
				    activity.switchContentHome();
					
				}
			});
			
		//------------------------------------------------------------------//
		 
	}


    @Override
    public void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
        MobclickAgent.onPageEnd("Message_content"); 
    }


    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        MobclickAgent.onPageStart("Message_content"); 
    }
}
